
<%@ page  import="com.quality.bean.DdParams"%>
<%@ page  import="com.quality.service.DingTalkService"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!doctype html>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>生产计划</title>

	  <meta charset="utf-8">
	  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

	<link rel="stylesheet" type="text/css" href="./css/bootstrap.css">

	<script type="text/javascript" src="./Js/jquery-3.5.1.min.js"></script>
	  <script type="text/javascript" src="./Js/bootstrap.js"></script>
  	<script type="text/javascript" src="./plugins/jquery.cookie.js"></script>

<script type="text/javascript" >
	
   var _globel_data;

	var uId = $.cookie('name');

   $(document).ready(function(){
	   getPlanList();

	   $('#sear').on('input propertychange', function() {

		   var searchText = $("#sear").val();
		   if(searchText.length >= 2){
			   var str= searchText.substring(0,2);
			   var reg=/^[1-9]\d*$|^0$/;
		   }

	   });
   });

 
   //获取列表内容(所属班组生产计划)
   function  getPlanList(){
       if(uId == '' ){
          getCookie();
       }
       getInfoByAjax('PlanLists',uId); //参数：userId
   
   }
   
   //动态绘制界面
	function loadingPlanList(data){
	   var body = "";
		$("#div_planLists").empty();	
         
		for ( var i = 0; i < data.length; i++) {
             body += ("<ul onclick=\"jumpQParamJsp('"+data[i]['ScOrder_Code']+"','"+data[i]['Gx_Code']+"')\">"
                     +"<li><div class=\"div_li_left\" ><a><b>"+data[i]['JH']+"</b></a><a>("+data[i]['Pweight']+")</a></div><div class=\"div_li_right\"><a>"+data[i]['Gx_Name']+"</a></div> </li>"
                     +"<li class=\"li_space\"><a>入库日期："+data[i]['OrderNeedDate']+"</a></li>"
                     +"<li class=\"li_space\"><a >产品名称：</a><a>"+data[i]['ProductName']+"</a></li>"
                     +"<li class=\"li_space\"><a >顾客名称：</a><a>"+data[i]['CustomerName']+"</a></li>"
                     +"<li class=\"li_space\" ><a >计划时间："+data[i]['JHKSDate']+" 至  "+data[i]['JhDate']+"</a></li>"
                     +"</ul>"
              );
             body += '<ul class="list-group" onclick="jumpQParamJsp(\''+data[i]['ScOrder_Code']+ '\',\''+data[i]['Gx_Code']+'\')>'
					 +'<li class="list-group-item">123456</li>'
					 +'<li class="list-group-item">Second item</li>'
					 +'<li class="list-group-item">Third item</li>'
					 +'</ul>';

		}
		$("#div_planLists").append(body);
		$("#div_planLists").show();
		body = "";
	
	}
	
	//公用ajax
	function getInfoByAjax(searchText,searchValue){
		$.ajax({
			type : "post",
			url : "servlet/SearchInfoServlet",
			data : {
				paramName : searchText,
				paramText : searchValue
			},
			dataType : "json",
			success : function(data, textStatus) {
			  //  alert("生产计划" + JSON.stringify(data));
			    if(data.length == 0){
			       alert("您所属班组无生产计划，请联系Foreman下达生产计划！");
			    }else{
					_globel_data = data;
			       loadingPlanList(data);
			    }
			     
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				alert("生产计划查询失败，请重试！"); //+ textStatus + errorThrown
			}
		});

	
	}
	
	function searchClick() {
		var searchString = $('#sear').val();
		if(searchString != '' && searchString != null && searchString != undefined){
			var localdata = [];
			$.each(_globel_data,function (index, value) {
				if(value['ProductName'].indexOf(searchString) != -1){
					localdata.push(value);
					return;
				}
				if(value['JH'].indexOf(searchString) != -1){
					localdata.push(value);
					return;
				}
			})

			loadingPlanList(localdata);
		}else{
			loadingPlanList(_globel_data);
		}
	}
	
	 function jumpQParamJsp(ScCode,Order){
	    //@参数1：生产订单号  @参数2：工序名称
	    window.location.href = "./Jsp/QParamsList.jsp?"+ScCode+"&"+Order;
	
	}

   function jumpGxDownload(){
	   //@参数1：生产订单号  @参数2：工序名称
	   window.location.href = "./Jsp/GYDownload.jsp";

   }
	

</script>


  </head>
  
 <body>
 
<%--    <table >--%>
<%--    	<tr >--%>
<%--    		<td  class="td1"><a >搜索：</a></td>--%>
<%--    		<td  class="td2"><input id="sear"  type="text" /></td>--%>
<%--      		<td class="td3"> <img alt="" src="./img/sear.png"  onclick="searchClick()"></td>--%>
<%--			<td class="td3"> <a onclick="jumpGxDownload();">工艺下载</a></td>--%>

<%--  		</tr>--%>

<%--    </table>--%>

<%--	<div id = "div_planLists"  >--%>
	   
	</div>
	<div class="container">
		<div class="row">
			<div class="col-sm-4">
				<h3>第一列</h3>
				<p>菜鸟教程</p>
				<p>学的不仅是技术，更是梦想！！！</p>
			</div>
			<div class="col-sm-4">
				<h3>第二列</h3>
				<p>菜鸟教程..</p>
				<p>学的不仅是技术，更是梦想！！！</p>
			</div>
			<div class="col-sm-4">
				<h3>第三列</h3>
				<p>菜鸟教程..</p>
				<p>学的不仅是技术，更是梦想！！！</p>
			</div>
			<div class="card">
				<div class="card-header">头部</div>
				<div class="card-body">内容</div>
				<div class="card-footer">底部</div>
			</div>
		</div>
	</div>
	
</body>
</html>